package ui.tp3.TP3Wicket;

import org.apache.wicket.validation.IValidatable;
import org.apache.wicket.validation.IValidator;
import org.apache.wicket.validation.ValidationError;


public class CreacionMapaValidator implements IValidator<Integer> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void validate(IValidatable<Integer> validatable) {
		final Integer v = validatable.getValue();
		
	
		if(v < 2){
			this.error(validatable, "mapa de una dimension");
		}
	}
	
	private void error(IValidatable<Integer> validatable, String msgError) {
		ValidationError error = new ValidationError();
		error.setMessage(msgError);
		validatable.error(error);
	}


}